/**
 * @ 用来向 my_database的user collection和blog collection 添加测试数据
 * 
 * 
 * 
 */
var userids = new Array();
var addressids = new Array();
var commits = new Array();

function insertTestData () {
	var nickNameArray = [
	'爱吃小黄豆',
	'维哥',
	'华夏一枝花',
	'我还可以抢救',
	'ayan',
	'闻言',
	'MIYI',
	'七夜',
	'简单的布',
	'雪天使'
	];
	var images = [
	'http://7u2l4r.com1.z0.glb.clouddn.com/21a4462309f790528b6455390ff3d7ca7bcbd5b9.jpg',
	'http://7u2l4r.com1.z0.glb.clouddn.com/a8ec8a13632762d000baa3b8a3ec08fa513dc635.jpg',
	'http://7u2l4r.com1.z0.glb.clouddn.com/e824b899a9014c087a4b1aa2097b02087bf4f440.jpg',
	'http://7u2l4r.com1.z0.glb.clouddn.com/e850352ac65c103802a0f6c5b1119313b17e89de.jpg',
	'http://7u2l4r.com1.z0.glb.clouddn.com/fcfaaf51f3deb48fe7deb0d9f31f3a292df57805.jpg'
	];
	for (var i = 0; i < 1000;i ++) {
		var userid = new ObjectId();
		var nameRandom = parseInt((Math.random()*nickNameArray.length));
		var nickName = nickNameArray[nameRandom];
		var password = 'Aa1052852269';
		var bind = 'zhaoyunpan123@sina.com';
		var type = 1;
		var imageRandom = parseInt((Math.random()*images.length));
		var image = images[imageRandom];
		db.user.insert({
			'_id':userid,
			'nickName':nickName,
			'password':password,
			'bind':bind,
			'headImage':image,
			'collected': new Array(),
			'comment': new Array(),
			'public' : new Array(),
			'type':type
		}
		);

		userids.push(userid);
	}
	for (var i = 0; i < 4; i++) {
		var content = "测试真是好";
		var id = new ObjectId();
		var date = new Date();
		commits.push(id);
		db.comment.insert({
			'_id':id,
			'content': content,
			'author':userids[i],
			'date' : date,
			'parent': commits.slice(0,i)
		})
	}
	for (var i = 0; i < 1000; i++) {
		var locationArray = [
		'深圳南山区深圳市南山区滨海大道辅路',
		'深圳福田区嘉麟豪庭',
		'深圳南山区深圳市南山区滨海大道辅路',
		'深圳福田区莲花山公园'
		];
		var addressArray = [
		'清华信息港',
		'海上世界',
		'深圳市图书馆',
		'深圳大学北门',
		'深圳市欢乐谷',
		'欢乐海岸'
		];
		var addressid = new ObjectId();
		var locationRandom = parseInt((Math.random()*locationArray.length));
		var location = locationArray[locationRandom];
		var addressRandom = parseInt((Math.random()*addressArray.length));
		var address = addressArray[addressRandom];
		var lat = 22.0;
		var lon = 133.0;

		db.address.insert({
			'_id':addressid,
			'address':address,
			'location':location,
			'lat':lat,
			'lon':lon,
			'isLocation':1
		})

		addressids.push(addressid);
	}


	for (var i = 0; i < 1000; i++) {
		var contents = [
		"希望我们一起溜冰是轻松愉悦的一种氛围，不在意溜的有多好，进步有多快，愿在保障你不摔跤安全的前提下慢慢帮你找到，那种在音乐声中，在冰面上，翩翩起舞的感觉！我一直以为，和自己喜欢的人，一起，手拉手，冰上飞舞，可以算作一种简单的浪漫！",
		'咨询报名联系小烟：电话13537524627 QQ 1793548847 微信：13537524627 QQ群：160444334 欢迎加入 '
		];
		var activityid = new ObjectId();
		var title = '周末一日游';
		var author = userids[i];
		var date = new Date();
		var content = contents[i%2];
		var images = [
		'http://7u2l4r.com1.z0.glb.clouddn.com/2015-02-13_15:32:45_Po6w776Q.jpg',
		'http://7u2l4r.com1.z0.glb.clouddn.com/2015-02-13_16:08:33_RcJtRyL2.jpg'
		];

		var commitArray = [];
		var commitCount = 0;
		var collect = [userids[0],userids[10],userids[1]];
		var address = addressids[i];
		var people = parseInt(Math.random()*20);
		var money = parseInt(Math.random()*50);
		var time = '2015/5/1';
		var city = parseInt(Math.random()*5);

		db.activity.insert({
			'_id':activityid,
			'title':title,
			'author':author,
			'date':date,
			'content':content,
			'images':images,
			'comment':commits,
			'collected':collect,
			'address':address,
			'people':people,
			'money':money,
			'time':time,
			'city':city
		})
	}

}